home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / server_add.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  9.6 KB  |  290 lines

  1. ∩╗┐<%@ CODEPAGE=65001 %>
  2. <!--#include file="include/wmsConstants.inc"-->
  3. <!--#include file="include/wmsLocStrings.inc"-->
  4. <!--#include file="include/wmsCommon.inc"-->
  5. <!--#include file="include/wmsServerHash.inc"-->
  6. <!--#include file="include/wmsfileio.inc"-->
  7. <!--#include file="include/wmsconnect.inc"-->
  8. <!--#include file="include/wmsHeader.inc"-->
  9. <!--#include file="include/wmsError.inc"-->
  10. <!--#include file="include/wmsHelp.inc"-->
  11. <%
  12. '+-------------------------------------------------------------------------
  13. '
  14. '  Microsoft Windows Media
  15. '  Copyright (C) Microsoft Corporation. All rights reserved.
  16. '
  17. '  File:       Server_Add.asp
  18. '
  19. '  Contents:
  20. '
  21. '--------------------------------------------------------------------------
  22.  
  23. Dim bCredentialsCanBeDelegated
  24. Dim strMeansOfAuthentication
  25.  
  26. bCredentialsCanBeDelegated = FALSE
  27. strMeansOfAuthentication = CStr( Request.ServerVariables( "AUTH_TYPE" ) )
  28. if( 0 < Len( strMeansOfAuthentication ) ) then
  29.     if( 0 <> StrComp( "Negotiate", strMeansOfAuthentication, vbTextCompare ) ) then
  30.         if( ( 0 = StrComp( "Basic",     strMeansOfAuthentication, vbTextCompare ) ) or _
  31.             ( 0 = StrComp( "Kerberos",  strMeansOfAuthentication, vbTextCompare ) ) or _
  32.             ( 0 = StrComp( "Digest",    strMeansOfAuthentication, vbTextCompare ) ) ) then
  33.             bCredentialsCanBeDelegated = TRUE
  34.         end if
  35.     end if
  36. end if
  37.  
  38. if( FALSE = bCredentialsCanBeDelegated ) then
  39.     Response.Redirect( "index.asp" )
  40.     Response.Flush
  41.     Response.End
  42. end if
  43.  
  44. '////////////////////////////////////////////////////////////////
  45. Function CreateBadXMLErrorString()
  46.     Dim strFileName
  47.     Dim strTemplate    
  48.     strFileName = "web\wmssecure\Users\" & Request.ServerVariables( "REMOTE_USER" ) & "_" & SERVERLISTFILENAME
  49.     strTemplate = Server.HTMLEncode( L_BADXML_TEXT )
  50.     CreateBadXMLErrorString = Replace( strTemplate, "___", RemoveDangerousCharacters( Replace( strFileName , "\", "\\" ) ), 1 )
  51. End Function
  52.  
  53. WriteHTMLHeader( L_ADDSERVER_TEXT ) %>
  54. <link rel="stylesheet" type="text/css" href="<%= Session( "cssName" ) %>">
  55. <%
  56. '
  57. '  This is a special case of our standard input request ASP page.  The reason is that there's a lot
  58. '   of processing that's going to be done, so we don't want to load 
  59. '
  60. Dim strErrDescription
  61. strErrDescription = CStr( qs( "error" ) )
  62.  
  63. function ExtractHelpTopic
  64.     if( "" = qs("helptopic") ) then
  65.         ExtractHelpTopic = H_SERVERLEVEL & H_SERVERLISTHELPTOPIC
  66.     else
  67.         ExtractHelpTopic = qs("helptopic")
  68.     end if
  69. end function
  70.  
  71. %>
  72. <script language="JavaScript" src="include/WMSCommon.js"></script>
  73. <script language="JavaScript">
  74. <!--
  75. var dbgNumFilterWarnings = 0;
  76.  
  77. <% WriteCommonJSUtils %>
  78.  
  79. ///////////////////////////////////////////////////////////////////////
  80. function AddServer( szSeed )
  81. {
  82.     var szServerName;
  83.     szServerName = new String( document.serveradd.server.value );
  84.     if( 0 >= szServerName.length )
  85.     {
  86.         window.alert( "<%= RemoveDangerousCharacters( L_INVALIDSERVERNAME_TEXT ) %>" );
  87.         document.serveradd.server.focus();
  88.         return;
  89.     }
  90.  
  91.     document.location.replace( "serverlist.asp?op=add&server=" + SafeEscape( szServerName ) + "&submit=Add" );
  92. }
  93.  
  94. ///////////////////////////////////////////////////////////////////////
  95. function EndDialog()
  96. {
  97.     document.location.replace( "serverlist.asp" );
  98. }
  99.  
  100. ///////////////////////////////////////////////////////////////////////
  101. function InitFilters()
  102. {
  103.     <% if "" <> qs("error") then %>
  104.     HandleError();
  105.     <% elseif "" <> qs("server") then %>
  106.     AddServer();
  107.     return;
  108.     <% end if %>
  109.  
  110.     var szServerName;
  111.     szServerName = new String( document.serveradd.server.value );
  112.     document.serveradd.server.focus();
  113.     if( 0 >= szServerName.length )
  114.     {
  115.         document.serveradd.add.disabled = true;
  116.         return;
  117.     }
  118.     else
  119.     {
  120.         document.serveradd.add.disabled = false;
  121.     }
  122. }
  123.  
  124. ///////////////////////////////////////////////////////////////////////
  125. function FilterInput()
  126. {
  127.     if( dbgNumFilterWarnings < 5 )
  128.     {
  129.         dbgNumFilterWarnings += 1;
  130.     }
  131.     
  132.     if( 4 >= dbgNumFilterWarnings )
  133.     {
  134.         window.status = "";
  135.     }
  136.     else
  137.     {
  138.         if( 5 == dbgNumFilterWarnings )
  139.         {
  140.             window.status = "";
  141.         }
  142.     }
  143.  
  144.     var rgchIllegalChars;
  145.     var chEachIllegalChar;
  146.     var i;
  147.     var dwNumIllgalChars;
  148.     var dwOffsetToFirstIllegalChar;
  149.     var szServerName;
  150.  
  151.     rgchIllegalChars = new String( " &+\\" );
  152.     dwNumIllgalChars = rgchIllegalChars.length;
  153.  
  154.     szServerName = new String( document.serveradd.server.value );
  155.     if( 0 >= szServerName.length )
  156.     {
  157.         document.serveradd.add.disabled = true;
  158.         return;
  159.     }
  160.  
  161.     for( i = 0; i < dwNumIllgalChars; i++ )
  162.     {
  163.         chEachIllegalChar = rgchIllegalChars.charAt( i );
  164.         dwOffsetToIllegalChar = szServerName.lastIndexOf( chEachIllegalChar );
  165.         if( -1 != dwOffsetToIllegalChar )
  166.         {
  167.             window.alert( "<%= RemoveDangerousCharacters( L_INVALIDSERVERNAME_TEXT ) %>" );
  168.             document.serveradd.server.value = szServerName.slice( 0, dwOffsetToIllegalChar );
  169.             return;
  170.         }
  171.     }
  172.  
  173.     document.serveradd.add.disabled = false;
  174. }
  175.  
  176. ///////////////////////////////////////////////////////////////////////
  177. function HandleError()
  178. {
  179.     <% 
  180.     strServerName = RemoveDangerousCharacters( Left( qs( "server" ), MAX_LEN_SERVERNAME ) )
  181.     if( 0 = StrComp( "badXML", strErrDescription, vbTextCompare ) ) then 
  182.     %>
  183.     if( window.confirm( "<%= CreateBadXMLErrorString %>" ) )
  184.     {        
  185.         document.location.replace( "serverlist.asp?op=add&server=" + SafeEscape( "<%= strServerName %>" ) + "&submit=Add&onErr=purgeXML" );
  186.     }
  187.     else
  188.     {
  189.         EndDialog();
  190.     }
  191.     <% elseif( 0 = StrComp( "duplicate", strErrDescription, vbTextCompare ) ) then %>
  192.     window.alert("<%= RemoveDangerousCharacters( strServerName & L_DUPLICATENAME_TEXT ) %>");
  193.     <% elseif( 0 = StrComp( "hostnotavailable", strErrDescription, vbTextCompare ) ) then %>
  194.     window.alert("<%= RemoveDangerousCharacters( strServerName & L_BADHOSTNAME_TEXT ) %>");
  195.     <% elseif( 0 = StrComp( "nowms", strErrDescription, vbTextCompare ) ) then %>
  196.     window.alert("<%= RemoveDangerousCharacters( strServerName & L_NOWMS_TEXT ) %>");
  197.     <% elseif( 0 = StrComp( "serviceerror", strErrDescription, vbTextCompare ) ) then %>
  198.     window.alert("<%= RemoveDangerousCharacters( strServerName & L_SERVICEINERROR_TEXT ) %>");
  199.     <% elseif( 0 = StrComp( "nocred", strErrDescription, vbTextCompare ) ) then %>
  200.     window.alert("<%= RemoveDangerousCharacters( L_INSUFFICIENTCRED_TEXT ) %>");
  201.     <% else %>
  202.     window.alert("<%= RemoveDangerousCharacters( strErrDescription ) %>");
  203.     <% end if %>
  204. }
  205. -->
  206. </script>
  207. </head>
  208. <body topmargin="10" leftmargin="10" rightmargin="10" marginwidth="10" marginheight="10" onload="JavaScript:InitFilters();" oncontextmenu="JavaScript:return true;event.cancelBubble=true;return false;">
  209. <% BeginErrorHandling %>
  210. </body>
  211. <% 
  212. if brMSIE <> g_dwBrowserType then 
  213. %>
  214. <br> <br>
  215. <% 
  216. end if
  217. %>
  218. <form name="serveradd" AUTOCOMPLETE="OFF">
  219. <table cellspacing="0" cellpadding="4" <% if brMSIE = g_dwBrowserType then %>class="dialogframe" <% else %> bgcolor="lightgrey" <% end if %> border=3><tr><td>
  220. <table width="<% if brMSIE = g_dwBrowserType then %>100%<% else %><%= Server.HTMLEncode( STDTABLEWIDTH ) %><% end if %>" cellspacing=5 cellpadding="0" cols="3" border="0">
  221. <tr>
  222.     <td width="32" valign="middle" align="left">
  223.         <img src="img/ServerAdd_32.gif" height="32" width="32" valign="middle">
  224.     </td>
  225.     <td align="left" valign="middle">
  226.         <span class="subheader" valign="middle"><%= Server.HTMLEncode( L_ADDSERVER_TEXT ) %> </span>
  227.         <p>
  228.     </td>
  229. </tr>
  230. </table>
  231. <table width="100%" cellspacing="1" cellpadding="1" border="0">
  232. <tr>
  233.     <td width="32">
  234.          
  235.     </td>
  236.     <td align="left">
  237.         <%= Server.HTMLEncode( L_ADDASERVERCOLON_TEXT ) %>
  238.     </td>
  239. </tr>
  240. <tr>
  241.     <td width="32">
  242.          
  243.     </td>
  244.     <td align="left">
  245.         <input 
  246.             type="text" 
  247.             size="<% if brMSIE <> g_dwBrowserType then %>48<% else %>64<% end if %>"
  248.             maxlength="254"
  249.             name="server" 
  250.             tabindex="1" 
  251.             value="<%= Server.HTMLEncode( qs("server" ) ) %>"
  252.             onKeyUp="JavaScript:FilterInput( this );"
  253.             onChange="JavaScript:FilterInput( this );"
  254.             onPaste="JavaScript:FilterInput( this );"
  255.             AUTOCOMPLETE="OFF"
  256.             >
  257.     </td>
  258.     <td width="32">
  259.          
  260.     </td>
  261. </tr>
  262. </table>
  263. <table cellspacing="4" cellpadding="0" border="0" <% if brMSIE = g_dwBrowserType then %> style="position:relative;left:64px;zOrder:1;"<% end if %>>
  264. <tr>
  265.     <td align="left">
  266.         <input class="button" name="add" onclick="JavaScript:AddServer();" tabIndex="2" type=button value="     <%= Server.HTMLEncode( L_ADDBUTTON_TEXT ) %>     "> 
  267.     </td>
  268.     <td align="left">
  269.         <input class="button" name="cancel" onclick="JavaScript:EndDialog();" tabIndex="3" type=button value=" <%= Server.HTMLEncode( L_CANCELBUTTONSPACED_TEXT ) %>"> 
  270.     </td>
  271.     <td align="left">
  272.         <input class="button" name="help" onclick="JavaScript:DoHelp( '<%= H_SERVERLEVEL %>','<%= ExtractHelpTopic() %>' );" tabIndex="4" type=button value="<%= L_HELPBUTTONSPACED_TEXT %>"> 
  273.     </td>
  274.     <td align="left">
  275.          
  276.     </td>
  277. </tr>
  278. </table>
  279. </td></tr></table>
  280. </form>
  281. </html>
  282. <% 
  283. EndErrorHandling "server_add.asp" 
  284.  
  285. on error resume next
  286. WMSServerHashASPCleanup
  287. WMSConnectASPCleanup
  288. WMSFileIOASPCleanup
  289. %>
  290.